package com.bite.lesson2;

import java.util.Scanner;

public class Demo_01 {
    public static void main(String[] args) {
        int n = 0;
        System.out.println("请输入：");
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            n = scanner.nextInt();

            Printf(n);
        }
    }

    private static void Printf(int n) {
        boolean flg = true;
        for (int i = 100; i < n; i++) {
            int sum = 0;
            int power = Numcount(i);
            int count = i;
            while (count != 0) {
                sum += Math.pow((count % 10),power);
                count /= 10;
            }
            if (sum == i) {
                flg = false;
                System.out.print(i + "  ");
            }
        }
        if (flg) {
            System.out.println("没有一个......");
        }
    }

    private static int Numcount(int n) {
        int count = 0;
        while (n != 0) {
            count++;
            n /= 10;
        }
        return count;
    }
}


